{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e21dce1d-964e-4c89-be23-b710ebc9b677",
   "metadata": {
    "tags": [
     "remove_cell"
    ]
   },
   "outputs": [],
   "source": [
    "import datapane as dp\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e6ffc18-d80a-443b-bf8a-9f921e997941",
   "metadata": {},
   "source": [
    "# Toggle\n",
    "\n",
    "::: datapane.Toggle"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5bd6f836-0c86-44fd-bffe-50f44abfc3d5",
   "metadata": {},
   "source": [
    "## Simple Toggle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "29d7277e-01d4-401b-aaf1-d37281bc670a",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import seaborn as sns\n",
    "import altair as alt\n",
    "\n",
    "code = \"\"\"\n",
    "titanic = sns.load_dataset(\"titanic\")\n",
    "\n",
    "app = dp.App(\n",
    "    \"# Titanic overview\",\n",
    "    dp.HTML(\n",
    "        '<html><img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/RMS_Titanic_3.jpg/1599px-RMS_Titanic_3.jpg\" style=\"height:400px;display:flex;margin:auto\"></img></html>'\n",
    "    ),\n",
    "    dp.Select(\n",
    "        blocks=[\n",
    "            dp.Table(titanic.describe(), label=\"Data Description\"),\n",
    "            dp.DataTable(titanic, label=\"Whole Dataset\"),\n",
    "            dp.Code(code, label=\"Source code\"),\n",
    "        ]\n",
    "    ),\n",
    ")\n",
    "\n",
    "app.save(path=\"select.html\")\n",
    "\"\"\"\n",
    "\n",
    "titanic = sns.load_dataset(\"titanic\")\n",
    "\n",
    "dp.Blocks(\n",
    "    \"# Titanic overview\",\n",
    "    dp.HTML(\n",
    "        '<html><img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/RMS_Titanic_3.jpg/1599px-RMS_Titanic_3.jpg\" style=\"height:400px;display:flex;margin:auto\"></img></html>'\n",
    "    ),\n",
    "    dp.Toggle(\n",
    "        blocks=[\n",
    "            dp.Table(titanic.describe(), label=\"Data Description\"),\n",
    "            dp.DataTable(titanic, label=\"Whole Dataset\"),\n",
    "            dp.Code(code, label=\"Source code\"),\n",
    "        ]\n",
    "    ),\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
